package com.wenjiang.controller;

import cn.hutool.core.date.DateUtil;
import com.wenjiang.service.impl.QuarzServiceImpl;
import com.wenjiang.task.TestJob;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class testController {

    @Autowired
    QuarzServiceImpl quarzService;

    @Autowired
    TestJob testJob;

    @RequestMapping("/addjob")
    public  void  addJob(){

        testJob.setClassName("com.wenjiang.task.TestJob");

//        yyyy-MM-dd HH:mm:ss
        testJob.setStartTime("2021-10-03 21:38:00:00");
        testJob.setJobName("test4");
        testJob.setJobGroup("test4");
        testJob.setJobDataMap(new JobDataMap());
        quarzService.addJob(testJob);
    }
}
